<?php
// ha nincs beolvasva adatbázisból, vagy már szerkesztettük
if (!isset($programsav_data->programsav_nev) || $programsav_data->programsav_nev != set_value('programsav_nev') && set_value('programsav_nev') != '') {
    $programsav_data->programsav_nev = set_value('programsav_nev');
}
if (!isset($programsav_data->programsav_rovid_leiras) || $programsav_data->programsav_rovid_leiras != set_value('programsav_rovid_leiras') && set_value('programsav_rovid_leiras') != '') {
    $programsav_data->programsav_rovid_leiras = set_value('programsav_rovid_leiras');
}
if (!isset($programsav_data->programsav_szin) || $programsav_data->programsav_szin != set_value('programsav_szin') && set_value('programsav_szin') != '') {
    $programsav_data->programsav_szin = set_value('programsav_szin');
}
if ($programsav_data->programsav_szin == '')
    $programsav_data->programsav_szin = "#0000ff"
    ?>

<?php
if (!isset($programsav_data->programsav_id)) {
    echo form_open("admin/programsavok/ajax_save_programsav", array('id' => 'htmlAjaxForm'));
    // ha új programsav, nem lesz programsav_id így csinálunk egyet ha kell a scripthez
    $programsav_data->programsav_id = "''";
} else {
    echo form_open("admin/programsavok/ajax_save_programsav/$programsav_data->programsav_id", array('id' => 'htmlAjaxForm'));
}
?>
<fieldset>
    <label class="fwf must">
        <span class="inputLabel">
            Programsáv megnevezése
        </span>
        <span class="inputWrap">
            <input class="" type="text" name="programsav_nev" value="<?php echo $programsav_data->programsav_nev ?>" />
        </span>
    </label>
    <label class="fwf textAreaHolder ">
        <span class="inputLabel">
            Rövid leírás
        </span>
        <textarea name="programsav_rovid_leiras" class=""><?php echo $programsav_data->programsav_rovid_leiras ?></textarea>
    </label>
    <label id="programLaneColorPickerContainer" class="">
        <span class="inputLabel">
            Program-sáv színe
        </span>

        <div id="colorSelector">
            <div style="background-color: <?php echo $programsav_data->programsav_szin ?>">
                <input type="hidden" name="programsav_szin" value="<?php echo $programsav_data->programsav_szin ?>" />
            </div>
        </div>

    </label>
</fieldset>
</form>

<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        // ColorPicker
	
        $('#colorSelector').ColorPicker({
            color: '#0000ff',
            onShow: function (colpkr) {
                $(colpkr).fadeIn(500);
                return false;
            },
            onHide: function (colpkr) {
                $(colpkr).fadeOut(500);
                return false;
            },
            onChange: function (hsb, hex, rgb) {
                $('#colorSelector div').css('backgroundColor', '#' + hex);
                $('#colorSelector input').val('#' + hex);
            }
        });
    });
</script>